#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <opencv2/opencv.hpp>

#include <QFileDialog>
#include <QMessageBox>
#include <QCloseEvent>

#include "ui_mainwindow.h"
#include "dialogprojectsettings.h"
#include "dialogcalibcams.h"
#include "dialogregistrationtargets.h"
#include "dialogtesteventcapture.h"
#include "dialogprocessvideo.h"
#include "dialogvisualize.h"

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT
    
public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    void closeEvent(QCloseEvent *event);

    QString projDir;
    QString eventName;  //directory of event
    QString testDesc;

    int camResolution;
    int numCams;

    int resWidth;
    int resHeight;

    bool projReady;
    bool calibReady;
    bool targetsReady;
    bool videoReady;
    bool resultsReady;

    cv::Mat matCam[2], matDist[2];  //camera matrix, and distortion coeffs for both cams

    cv::Mat_<cv::Point2f> targetCam0, targetCam1;  //Image Target Points
    cv::Mat_<cv::Point3f> targetWorld;             //World Target Points

    
private slots:
    void on_pushButton_CameraCalibrate_clicked();

    void on_pushButton_ProjSettings_clicked();

    void on_pushButton_RefTargets_clicked();

    void on_pushButton_TestEvent_clicked();

    void on_pushButton_ReviewResults_clicked();

    void on_pushButton_ProcessVideo_clicked();

    bool CheckCalibReady();
    bool CheckTargetsReady();
    bool CheckVideoReady();
    bool checkResultsReady();



    void on_actionProject_Settings_triggered();

    void on_actionCalibrate_Cameras_triggered();

    void on_actionSet_Reference_Targets_triggered();

    void on_actionTest_Event_Capture_triggered();

    void on_actionEvent_Processing_triggered();

    void on_actionReview_Results_triggered();

    void on_actionExit_triggered();

private:
    Ui::MainWindow *ui;
    dialogRegistrationTargets* regTargets;
    dialogCalibCams* calibCams;
    DialogVisualize* dlgVis;

    //some label formatting stuff
    QString redFont,greenFont,blueFont,endFont;

};

#endif // MAINWINDOW_H
